<%@ Page Language="C#" MasterPageFile="~/Board.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="UserInterface.Index" %>

<asp:Content ID="ForumsContent" ContentPlaceHolderID="ContentPlaceHolder" runat="server">
    <cc:Repeater runat="server" OnItemCreated="CategoriesRepeater_ItemCreated" ID="CategoriesRepeater">
        <HeaderTemplate>
            <table class="list-table">
                <tr>
                    <th class="forum-title-width"><%= Resources.Resource.Forum %></th>
                    <th class="topic-count-width"><%= Resources.Resource.Topics %></th>
                    <th class="post-count-width"><%= Resources.Resource.Replies %></th>
                    <th class="last-post-width"><%= Resources.Resource.LastPost %></th>
                </tr>
        </HeaderTemplate>

        <ItemTemplate>
                <tr>
                    <td class="category-header" colspan="4"><%# Eval("Name") %></div>
                </tr>
                <asp:Repeater runat="server" OnItemDataBound="ForumsRepeater_ItemDataBound" ID="ForumsRepeater" DataSource='<%# GetForumsByCategory(Container.DataItem as Domain.Entities.Category) %>'>
                    <ItemTemplate>
                        <tr>
                               <td class="default-column"><a href="ViewForum.aspx?forumId=<%# Eval("Id") %>"><asp:Image ID="ForumImage" ImageUrl="~/Templates/Default/Images/forum-read.gif" AlternateText="" runat="server" /><%# Eval("Name") %></a></td>
                               <td class="default-column"><%# Eval("NumberOfTopics")%></td>
                               <td class="default-column"><%# Eval("NumberOfReplies")%></td>
                               <td class="default-column">
                                    <asp:PlaceHolder ID="LastMessagePlaceHolder" runat="server" Visible='<%# Eval("LastMessage") != null %>'>
                                        <span class="small-text"><a href="ViewTopic.aspx?topicId=<%# Eval("LastMessage.Topic.Id") %>"><img src="Templates/Default/Images/Icons/last-post.gif" alt=""><%# Eval("LastMessage.PostDateTime") %></a></span>
                                    </asp:PlaceHolder>     
                               </td>
                                    
                        </tr>
                    </ItemTemplate>
                    <AlternatingItemTemplate>
                         <tr>
                               <td class="alternate-column"><a href="ViewForum.aspx?forumId=<%# Eval("Id") %>"><asp:Image ID="ForumImage" ImageUrl="~/Templates/Default/Images/forum-read.gif" AlternateText="" runat="server" /><%# Eval("Name") %></a></td>
                               <td class="alternate-column"><%# Eval("NumberOfTopics")%></td>
                               <td class="alternate-column"><%# Eval("NumberOfReplies")%></td>
                               <td class="alternate-column">
                                    <asp:PlaceHolder ID="LastMessagePlaceHolder" runat="server" Visible='<%# Eval("LastMessage") != null %>'>
                                        <span class="small-text"><a href="ViewTopic.aspx?topicId=<%# Eval("LastMessage.Topic.Id") %>"><img src="Templates/Default/Images/Icons/last-post.gif" alt=""><%# Eval("LastMessage.PostDateTime") %></a></span>
                                    </asp:PlaceHolder>   
                               </td>
                        </tr>
                    </AlternatingItemTemplate>
                </asp:Repeater>
        </ItemTemplate>
        
        <FooterTemplate>
            </table>
            <div id="bottom-extra">
                <a href="RSS/Index.aspx"><img src="Templates/<%=CurrentTemplate%>/Images/rss-icon.gif" alt="RSS" border="0"></a>
            </div>
        </FooterTemplate>
        <EmptyTemplate>
            <div id="no-forums-message">
                <p><%= GetLocalResourceObject("NoForumsMessage") %></p>
            </div>
        </EmptyTemplate>
    </cc:Repeater>
</asp:Content>
